/*
 *  Copyright (C), 2015-2024
 *  FileName: instance_manager
 *  Author: Tonight丶相拥
 *  Date: 5/16/24
 *  Description: 
 **/

part of 'flutter_tool.dart';

class CustomInstanceManager {
  CustomInstanceManager._();

  final Map<Type, dynamic> _instanceContainer = {};

  static CustomInstanceManager? _manager;
  static CustomInstanceManager get instance
      => _manager ??= CustomInstanceManager._();
  // static void configInitializeInstance(){
  //   _manager ??= CustomInstanceManager._();
  //   _initializeInstance();
  // }

  void setInstance<T>(T value){
    _instanceContainer[value.runtimeType] = value;
  }

  T? getInstance<T>() {
    return _instanceContainer[T.runtimeType];
  }
}